Forum:Switchtabs
I have just developed some JS and CSS that adds three tabs onto each main, inventory, or review page. They look a bit like this: If you want to experience them first hand, you will have to copy the contents of User:UltrasonicNXT/wikia.css/tabs.css and User:UltrasonicNXT/wikia.js/tabs.js into your personal CSS and JS files. They are only currently meant for Oasis, but if you Monobook users want something similar I'm sure we can sort that out. If something doesn't work for you, please tell me, and give me a description and what browser and version you are using. So do we want them? Any what do you think of them? * Fantastic work NXT, once again! :D Though would it be possible to make on for instructions and have it in red perhaps? :) 19:54, December 19, 2011 (UTC) *: LEGO.com instructions? At a glance, no. I tried to do something a bit like this with instructions before (I even ended up emailing Customer Service), and as far as I know, you would have to give a reference from every set page to it's counterpart instructions at LEGO.com. *::We already do, don't we? And will the tabs show up if there is no inventory/review? 20:03, December 19, 2011 (UTC) *:::I can't see it... Safari, version 5.0.5 20:08, December 19, 2011 (UTC) :::::First comment; yes, I wanted for there to be an easy way to make it, if it wasn't already there. Second; I'll look into it. Have you waited a bit, and cleared the cache? ::::::You need to put them in the master wikia.css/js, not the subpages. I have made this clearer above now. ::But we can upload PDFs now, a few pages even have the instructions on them, for example File:4181.pdf is featured on 4181 Isla De Muerta like that. -[[User:King of Nynrah|'KoN']] [[User talk:King of Nynrah|'Talk']] 11:39, December 31, 2011 (UTC) *Great work! Could you program the review tab to somehow auto-create the review page when clicked if it doesn't exist? I think I know how, but I might break something :p 04:15, December 21, 2011 (UTC) :*That would be alot harder than what I've done so far. The hard bit is detecting whether the page exists. Easy in wikitext, but not in JS. 08:41, December 21, 2011 (UTC) * Looks great, however, as far as I can see, doesn't this work for every single page in the mainspace/review space/inventory space? Thing is, we really don't want them to appear for things like April 9, Star Wars, etc- it would lead to spam, people getting encouraged to follow redlinks which shouldn't exist, people thinking they should be writing theme/minifigure reviews... so if this is the case, oppose for those reasons. Not opposing the idea obviously, we really need to do this somehow, and the appearance looks great. If only we could use the script tag, it would be so easy... (build the javascript into the set infobox) 08:54, December 21, 2011 (UTC) *: You've done it! I will build it in to the set infobox. Then use JS and CSS. update to come * I've done it now! Any pages with transcluded onto them will have the tabs. (If you have the code in your skin files.) I'm going to make a minifigures one with just Wiki and Inv. (got to rush now) ** The great coder's done it again :P (I'll assume it works for now, in a bit of a rush again). Would you be able to explain to be how it works only if switchtabs is present (so I can do the Monobook)? To me, the JS file looks like it's wrapping the code in a switchtabs div, and it's still doing it for all pages 00:17, December 22, 2011 (UTC) ***Everywhere apart from my wikia.js has the old code. Basically, the div is put there by the template, totally empty. JS then adds the three links inside it (which are given colours by the CSS). That's pretty much it. If you like, I'll do something for monobook, but I thought I best leave it to a monobook user. * Just letting any Monobookers out there know I'm trying to get it to work, just by adding on to the normal buttons at the top, but I'm not getting anywhere with it really. I might be active for a few days, so here's a code dump in case anyone wants to take it on (it could be completely wrong though): function extraButtons(){ if(document.getElementById("switchtabs") != null){ //Presence of switchtab div essentially acting as a trigger for buttons to appear var page = wgTitle; var inv = " Inventory "; var rev = " Reviews "; var wiki = " Article "; var ns = wgNamespaceNumber; var theDiv = document.getElementsByClassName("pBody"); var theUls = theDiv.getElementsByTagName("a"); var theUl = theUl0; switch(ns){ case 0: theUl.innerHTML += inv; theUl.innerHTML += rev; break; case 114: theUl.innerHTML += wiki; theUl.innerHTML += rev; break; case 118: theUl.innerHTML += wiki; theUl.innerHTML += inv; break; } } } addOnloadHook(extraButtons); I'm not worried about getting just inv (and no reviews tab) to show up for minifigures yet, just trying to get the basics done. 10:46, December 23, 2011 (UTC) * *: But am having some probs... Encyclopaedia should be spelled without an A for consistency... FB100Z • talk • 01:11, January 5, 2012 (UTC) * It would stop a million people telling us we're spelling it "wrong"... 01:49, January 5, 2012 (UTC) *:Note that I said consistency, not accuracy :P We don't call ourselves Brickipaedia, though. FB100Z • talk • 04:38, January 5, 2012 (UTC)